﻿using Bentley.CifNET.Objects;
using Bentley.GeometryNET.Common;
using CheccCoverplateCulvertAssemble.Common;
using CheccCoverplateCulvertAssemble.Common.Total;
using CheccCoverplateCulvertAssemble.Conmmon;
using CheccCoverplateCulvertAssemble.Entity;
using CheccCoverplateCulvertAssemble.Tools;
using CheccTexturePropertyGive;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 平交口设计.solid;
using static Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify;
using static CheccTexturePropertyGive.SetCoverCulvertTexture;

namespace CheccCoverplateCulvertAssemble.Operation
{
    internal class EndWall : ConstructingEntity
    {
        EndWallBase wallBase;
        CapStoneBase stoneBase;
        CapLocation capLocation;
        double culvertLength;
        public EndWall(EndWallBase endWallBase, CapStoneBase stoneBase, BasicConstructor basicConstructor, double culvertLength, CapLocation capLocation, CulvertType culvertType, ConstructionMethod constructionMethod, CulvertComponentType culvertComponentType) :
            base(basicConstructor, culvertType, constructionMethod, culvertComponentType)
        {
            this.wallBase = endWallBase;
            this.stoneBase = stoneBase;
            this.capLocation = capLocation;
            this.culvertLength = culvertLength;
        }

        public override void CreateEntityModel()
        {
            var coverParameter = GetUorCoverParameter();
            double lateralAngle = 0;
            double baseSlope = 0;
            if (capLocation == CapLocation.Left)
            {
                lateralAngle = coverParameter.leftLateralAngle;
                baseSlope = coverParameter.baseSlope;
            }
            else
            {
                double angle = 90.0 - coverParameter.rightLateralAngle;
                if (coverParameter.rightLateralAngle > 90)
                {
                    lateralAngle = 90.0 - Math.Abs(angle);
                }
                else
                {
                    lateralAngle = 90.0 + Math.Abs(angle);
                }

                baseSlope = coverParameter.baseSlope > 0 ? -coverParameter.baseSlope : Math.Abs(coverParameter.baseSlope);
            }

            var wallObj = CreateEndWallSuface(
                this.wallBase.Slope,
                this.wallBase.BaseBurialDepth * 0.01,
                this.wallBase.Height * 0.01,
                this.wallBase.BaseNumberOfPlies,
                this.wallBase.BaseHeight * 0.01,
                this.wallBase.Width * 0.01,
                this.wallBase.Overhang * 0.01,
                this.wallBase.EdgeIn * 0.01,
                this.wallBase.EdgeOut * 0.01,
                coverParameter.piecePly + coverParameter.clearHeight,
                coverParameter.clearSpan,
                coverParameter.basicsEdge,
                coverParameter.basicsPly,
                baseSlope,
                lateralAngle,
                coverParameter.standPly
                );
            CommonData.Instance.ElementIds.Add(wallObj.wallElement.ElementId.ToString());
            CommonData.Instance.ElementIds.AddRange(wallObj.basicEles.Select(s => s.ElementId.ToString()));
            FormColl.Assemble.SetTableData("一字翼墙", GeneralHelpers.SerializeDatas.SlabCulvertData.Headwall.Texture, GeneralHelpers.GetCSVDatas("端墙")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(wallObj.wallElement, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
            foreach (Element basicEle in wallObj.basicEles)
            {
                FormColl.Assemble.SetTableData("一字翼墙", GeneralHelpers.SerializeDatas.SlabCulvertData.Headwall.Texture, GeneralHelpers.GetCSVDatas("端墙基础")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(basicEle, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
            }
            

            Element capStone = CreateCapStone(
                this.wallBase.Overhang * 0.01 * 2 + coverParameter.clearSpan,
                stoneBase.Width * 0.01,
                stoneBase.Chamfering * 0.01,
                stoneBase.Height * 0.01,
                stoneBase.OutQuantity * 0.01,
                this.wallBase.Height * 0.01,
                baseSlope,
                lateralAngle
                );
            CommonData.Instance.ElementIds.Add(capStone.ElementId.ToString());
            FormColl.Assemble.SetTableData("帽石", GeneralHelpers.SerializeDatas.SlabCulvertData.CapRock.Texture, GeneralHelpers.GetCSVDatas("帽石")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(capStone, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");

            //真实位置
            DTransform3d dTransform = new DTransform3d(this.dMatrix3D);

            dTransform.Translation = this.placeDpoint3d * GeneralBank.UorToMeters;
            TransformInfo dTransFormInfo = new TransformInfo(dTransform);
            if (capLocation == CapLocation.Left)
            {
                wallObj.wallElement.ApplyTransform(dTransFormInfo);
                wallObj.wallElement.ReplaceInModel(wallObj.wallElement);
                SetCoverCulvertTexture setCoverCulvertTexture = new SetCoverCulvertTexture();
                setCoverCulvertTexture.CoverCulvertTexture(wallObj.wallElement, CoverCulvertConstruction.HeadWall);
                foreach (Element item in wallObj.basicEles)
                {
                    item.ApplyTransform(dTransFormInfo);
                    item.ReplaceInModel(item);
                    setCoverCulvertTexture = new SetCoverCulvertTexture();
                    setCoverCulvertTexture.CoverCulvertTexture(item, CoverCulvertConstruction.Basis);
                }
                capStone.ApplyTransform(dTransFormInfo);
                capStone.ReplaceInModel(capStone);
                setCoverCulvertTexture = new SetCoverCulvertTexture();
                setCoverCulvertTexture.CoverCulvertTexture(capStone, CoverCulvertConstruction.CapStone);
            }
            else
            {
                DPoint3d movePt = new DPoint3d(culvertLength, 0, culvertLength * coverParameter.baseSlope) * GeneralBank.UorToMeters;
                DPoint3d mirrorPt = new DPoint3d(culvertLength, 0, 0) * GeneralBank.UorToMeters;
                DTransform3d.TryMirrorPointToPoint(DPoint3d.Zero, mirrorPt, out DTransform3d trans);
                trans.Translation = movePt;

                wallObj.wallElement.ApplyTransform(new TransformInfo(trans));
                wallObj.wallElement.ApplyTransform(dTransFormInfo);
                wallObj.wallElement.ReplaceInModel(wallObj.wallElement);
                SetCoverCulvertTexture setCoverCulvertTexture = new SetCoverCulvertTexture();
                setCoverCulvertTexture.CoverCulvertTexture(wallObj.wallElement, CoverCulvertConstruction.HeadWall);

                foreach (Element item in wallObj.basicEles)
                {
                    item.ApplyTransform(new TransformInfo(trans));
                    item.ApplyTransform(dTransFormInfo);
                    item.ReplaceInModel(item);
                    setCoverCulvertTexture = new SetCoverCulvertTexture();
                    setCoverCulvertTexture.CoverCulvertTexture(item, CoverCulvertConstruction.Basis);
                }
                capStone.ApplyTransform(new TransformInfo(trans));
                capStone.ApplyTransform(dTransFormInfo);
                capStone.ReplaceInModel(capStone);

                setCoverCulvertTexture = new SetCoverCulvertTexture();
                setCoverCulvertTexture.CoverCulvertTexture(capStone, CoverCulvertConstruction.CapStone);
            }
        }

        /// <summary>
        /// 创建单侧端墙
        /// </summary>
        /// <param name="slope">墙背坡比</param>
        /// <param name="baseThickness">基础埋深</param>
        /// <param name="topWallHeight">涵顶以上墙高</param>
        /// <param name="baseLeyer">基础层数</param>
        /// <param name="baseHeight">基础高度</param>
        /// <param name="topWallWidth">墙顶宽度</param>
        /// <param name="overhangValue">墙体外悬值</param>
        /// <param name="inEdge">内侧基础襟边</param>
        /// <param name="outEdge">外侧基础襟边</param>
        /// 
        /// <param name="culvertHight">洞身高（从外侧顶部到内侧底部）</param>
        /// <param name="culverWidth">洞身宽</param>
        /// <param name="culvertEdge">洞身基础襟边</param>
        /// <param name="culverThickness">洞身基础厚度</param>
        /// <param name="baseSlope">涵底坡度</param>
        /// <param name="leftLateralAngle"> 左偏角</param>
        /// <param name="standPly"> 台身厚度</param>
        private (Element wallElement, List<Element> basicEles) CreateEndWallSuface(double slope, double baseThickness, double topWallHeight, double baseLeyer, double baseHeight, double topWallWidth, double overhangValue, double inEdge, double outEdge,
            double culvertHight, double culverWidth, double culvertEdge, double culverThickness, double baseSlope, double leftLateralAngle, double standPly)
        {
            List<Element> basics = new List<Element>();
            //墙高
            double wallHeight = topWallHeight + culvertHight + baseThickness;
            //墙背坡度偏移长度
            double offsetBySlope = slope == 9999 || slope == 0 ? 0 : Math.Abs(wallHeight / slope);
            //端墙长度
            double wallLength = overhangValue * 2 + culverWidth;
            //涵身角度偏移长度
            double LeftLateralOffset = (wallLength) * Math.Tan((90 - leftLateralAngle) * Math.PI / 180);


            #region 构造墙身
            DPoint3d[] points =
            {
                new DPoint3d(0,0,0) * GeneralBank.UorToMeters,
                new DPoint3d(topWallWidth,0,0) * GeneralBank.UorToMeters,
                new DPoint3d(topWallWidth + offsetBySlope,0,-wallHeight) * GeneralBank.UorToMeters,
                new DPoint3d(0,0,-wallHeight) * GeneralBank.UorToMeters,
                new DPoint3d(0,0,0) * GeneralBank.UorToMeters
            };
            ShapeElement shapeElement = new ShapeElement(GeneralBank.ActiveDgnModel, null, points);
            //shapeElement.AddToModel();
            CurveVector secCur = shapeElement.GetCurveVector();
            LineElement lineElement = new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d(
                DPoint3d.Zero,
                new DPoint3d(LeftLateralOffset, wallLength, LeftLateralOffset * baseSlope) * GeneralBank.UorToMeters
                ));
            CurveVector linePath = lineElement.GetCurveVector();
            SolidKernelEntity solidKernel = CreateBodyFromSweep(linePath, secCur, GeneralBank.ActiveDgnModel);
            //变换移动
            DPoint3d movePoint3d = new DPoint3d(
                leftLateralAngle > 90 ? Math.Abs(LeftLateralOffset / 2) : -Math.Abs(LeftLateralOffset / 2),
                -wallLength / 2,
                -LeftLateralOffset / 2 * baseSlope + topWallHeight) * GeneralBank.UorToMeters;
            DTransform3d trans = DTransform3d.Identity;
            trans.Translation = movePoint3d;
            TransformBody(ref solidKernel, trans);

            //构造剪切体
            //double culverWidthOffset = culverWidth / 2 * Math.Tan((90 - leftLateralAngle) * Math.PI / 180);
            double cutOffset = Math.Abs((culverWidth / 2 + standPly + culvertEdge) * Math.Tan((90 - leftLateralAngle) * Math.PI / 180));
            double offseZ = cutOffset * baseSlope;
            DPoint3d[] cutPts =
            {
                new DPoint3d(0 ,culverWidth / 2 + standPly ,0) * GeneralBank.UorToMeters,
                new DPoint3d(0 ,culverWidth / 2 + standPly,-culvertHight ) * GeneralBank.UorToMeters,
                new DPoint3d(0 ,culverWidth / 2 + standPly + culvertEdge ,-culvertHight) * GeneralBank.UorToMeters,
                new DPoint3d(0 ,culverWidth / 2 + standPly + culvertEdge ,-(culvertHight + culverThickness)) * GeneralBank.UorToMeters,
                new DPoint3d(0 ,-(culverWidth / 2 + standPly + culvertEdge) , -(culvertHight + culverThickness)) * GeneralBank.UorToMeters,
                new DPoint3d(0 ,-(culverWidth / 2 + standPly + culvertEdge) , -culvertHight) * GeneralBank.UorToMeters,
                new DPoint3d(0 ,-(culverWidth / 2 + standPly),-culvertHight) * GeneralBank.UorToMeters,
                new DPoint3d(0 ,-(culverWidth / 2 + standPly),0) * GeneralBank.UorToMeters
            };
            ShapeElement cutEle = new ShapeElement(GeneralBank.ActiveDgnModel, null, cutPts);
            //cutEle.AddToModel();

            LineElement cutLien = GetSlopLinee(DPoint3d.Zero, topWallWidth + offsetBySlope + Math.Abs(cutOffset * 2), baseSlope, out DPoint3d pt);
            SolidKernelEntity CutSolid = CreateBodyFromSweep(cutLien.GetCurveVector(), cutEle.GetCurveVector(), GeneralBank.ActiveDgnModel);
            movePoint3d = new DPoint3d(-cutOffset, 0, -offseZ) * GeneralBank.UorToMeters;
            trans = DTransform3d.Identity;
            trans.Translation = movePoint3d;
            TransformBody(ref CutSolid, trans);


            SolidKernelEntity[] cutSolidKernels = new SolidKernelEntity[] { CutSolid };
            BodyBooleanSubtract(ref solidKernel, ref cutSolidKernels, 1);
            Convert1.BodyToElement(out Element wallElement, solidKernel, null, GeneralBank.ActiveDgnModel);
            wallElement.AddToModel();
            //属性赋予
            SetCoverCulvertECProperty setCoverCulvertECProperty = new SetCoverCulvertECProperty();
            setCoverCulvertECProperty.SetHeadWallECProperty(
                wallElement,
                wallLength.ToString(),
                wallHeight.ToString(),
                topWallWidth.ToString(),
                (topWallWidth + offsetBySlope).ToString(),
                "",
                0.ToString(),
                slope.ToString()
                );
            #endregion


            #region 构造基础
            //单个基础高
            double baseHeightOne = baseHeight / (int)baseLeyer;
            for (int i = 1; i <= (int)baseLeyer; i++)
            {
                DPoint3d[] basicPts =
                {
                    new DPoint3d(-(i * inEdge),0,- (wallHeight + baseHeightOne *(i-1))) * GeneralBank.UorToMeters,
                    new DPoint3d(topWallWidth + offsetBySlope + i * inEdge,0,-(wallHeight + baseHeightOne *(i-1))) * GeneralBank.UorToMeters,
                    new DPoint3d(topWallWidth + offsetBySlope + i * inEdge,0,-(wallHeight + baseHeightOne * i)) * GeneralBank.UorToMeters,
                    new DPoint3d(-(i * inEdge),0,- (wallHeight + baseHeightOne *i)) * GeneralBank.UorToMeters,
                    new DPoint3d(-(i * inEdge),0,- (wallHeight + baseHeightOne *(i-1))) * GeneralBank.UorToMeters
                };
                ShapeElement basicEE = new ShapeElement(GeneralHelpers.ActiveDgnModel, null, basicPts);

                double basicLen = (wallLength + outEdge * 2 * i);
                double offset = basicLen * Math.Tan((90 - leftLateralAngle) * Math.PI / 180);


                LineElement line = new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d(
                DPoint3d.Zero,
                new DPoint3d(offset, basicLen, offset * baseSlope) * GeneralBank.UorToMeters
                ));
                CurveVector lineCur = line.GetCurveVector();
                SolidKernelEntity solidKerne = CreateBodyFromSweep(lineCur, basicEE.GetCurveVector(), GeneralBank.ActiveDgnModel);

                movePoint3d = new DPoint3d(-offset / 2, -basicLen / 2, -offset / 2 * baseSlope + +topWallHeight) * GeneralBank.UorToMeters;
                trans = DTransform3d.Identity;
                trans.Translation = movePoint3d;
                TransformBody(ref solidKerne, trans);
                Convert1.BodyToElement(out Element basicElement, solidKerne, null, GeneralBank.ActiveDgnModel);
                basicElement.AddToModel();
                basics.Add(basicElement);

                //属性赋予
                setCoverCulvertECProperty = new SetCoverCulvertECProperty();
                setCoverCulvertECProperty.SetHeadWallBasisECProperty(
                    basicElement,
                    outEdge.ToString(),
                    inEdge.ToString(),
                    baseHeightOne.ToString(),
                    baseLeyer.ToString()
                    );
            }
            #endregion

            return (wallElement, basics);
        }


        /// <summary>
        /// 创建帽石
        /// </summary>
        /// <param name="capLength">帽石长度</param>
        /// <param name="capWidth">帽石宽度</param>
        /// <param name="capChamfer">帽石倒角</param>
        /// <param name="capHeight">帽石高度</param>
        /// <param name="capSuspendOutValue">帽石悬出值</param>
        /// <param name="topWallHeight"> 涵顶以上墙高</param>
        /// <param name="baseSlope">涵底坡度</param>
        /// <param name="lateralAngle">偏移角度</param>
        private Element CreateCapStone(double capLength, double capWidth, double capChamfer, double capHeight, double capSuspendOutValue, double topWallHeight, double baseSlope, double lateralAngle)
        {
            #region 帽石
            //涵身角度偏移长度
            double lateralOffset = (capLength) * Math.Tan((90 - lateralAngle) * Math.PI / 180);
            double lateralOffsetZ = lateralOffset * baseSlope;
            //创建截面
            DPoint3d[] points =
            {
                new DPoint3d(-capSuspendOutValue,0,0) * GeneralBank.UorToMeters,
                new DPoint3d(-capSuspendOutValue,0,capHeight - capChamfer) * GeneralBank.UorToMeters,
                new DPoint3d(-capSuspendOutValue + capChamfer,0,capHeight) * GeneralBank.UorToMeters,
                new DPoint3d(-capSuspendOutValue + capWidth,0,capHeight) * GeneralBank.UorToMeters,
                new DPoint3d(-capSuspendOutValue + capWidth,0,0) * GeneralBank.UorToMeters,
                new DPoint3d(-capSuspendOutValue,0,0) * GeneralBank.UorToMeters
            };

            ShapeElement profileCap = new ShapeElement(GeneralBank.ActiveDgnModel, null, points);
            //profileCap.AddToModel();
            //截面拉伸
            LineElement lineElementCap = new LineElement(GeneralBank.ActiveDgnModel, null,
                new DSegment3d(DPoint3d.Zero, new DPoint3d(lateralOffset, capLength, lateralOffsetZ) * GeneralBank.UorToMeters));
            SolidKernelEntity capEntity = CreateBodyFromSweep(lineElementCap.GetCurveVector(), profileCap.GetCurveVector(), GeneralBank.ActiveDgnModel);
            #endregion

            #region 倒角
            double chamferOffset = (capChamfer) * Math.Sin((90 - lateralAngle) * Math.PI / 180);
            double lengthY = Math.Abs((capChamfer) * Math.Cos((90 - lateralAngle) * Math.PI / 180));
            double chamferOffsetZ = chamferOffset * baseSlope;
            //左侧倒角截面
            points = new DPoint3d[]
            {
                new DPoint3d (capWidth - capSuspendOutValue,0,capHeight - capChamfer)* GeneralBank.UorToMeters,
                new DPoint3d (capWidth - capSuspendOutValue,0,capHeight)* GeneralBank.UorToMeters,
                new DPoint3d (capWidth - capSuspendOutValue + chamferOffset,lengthY,capHeight + chamferOffsetZ)* GeneralBank.UorToMeters,
                new DPoint3d (capWidth - capSuspendOutValue,0,capHeight - capChamfer)* GeneralBank.UorToMeters,
            };
            ShapeElement chamferShapeLeft = new ShapeElement(GeneralBank.ActiveDgnModel, null, points);
            LineElement chamferLienLeft = new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d(
                new DPoint3d(capWidth - capSuspendOutValue, 0, capHeight) * GeneralBank.UorToMeters,
                new DPoint3d(-capSuspendOutValue, 0, capHeight) * GeneralBank.UorToMeters));
            SolidKernelEntity chamferLeft = CreateBodyFromSweep(chamferLienLeft.GetCurveVector(), chamferShapeLeft.GetCurveVector(), GeneralBank.ActiveDgnModel);
            //chamferLienLeft.AddToModel();
            //右侧倒角截面
            points = new DPoint3d[]
            {
                new DPoint3d (capWidth - capSuspendOutValue + lateralOffset ,capLength,capHeight - capChamfer + lateralOffsetZ)* GeneralBank.UorToMeters,
                new DPoint3d (capWidth - capSuspendOutValue + lateralOffset,capLength,capHeight + lateralOffsetZ)* GeneralBank.UorToMeters,
                new DPoint3d (capWidth - capSuspendOutValue + lateralOffset - chamferOffset,capLength - lengthY,capHeight + lateralOffsetZ - chamferOffsetZ)* GeneralBank.UorToMeters,
                new DPoint3d (capWidth - capSuspendOutValue + lateralOffset ,capLength,capHeight - capChamfer + lateralOffsetZ)* GeneralBank.UorToMeters
            };
            ShapeElement chamferShapeRight = new ShapeElement(GeneralBank.ActiveDgnModel, null, points);
            LineElement chamferLienRight = new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d(
                new DPoint3d(capWidth - capSuspendOutValue + lateralOffset, capLength, capHeight + lateralOffsetZ) * GeneralBank.UorToMeters,
                new DPoint3d(-capSuspendOutValue + lateralOffset, capLength, capHeight + lateralOffsetZ) * GeneralBank.UorToMeters));
            SolidKernelEntity chamferRight = CreateBodyFromSweep(chamferLienRight.GetCurveVector(), chamferShapeRight.GetCurveVector(), GeneralBank.ActiveDgnModel);
            //chamferLienRight.AddToModel();
            //差集
            SolidKernelEntity[] solidKernelEntities = new SolidKernelEntity[] { chamferLeft, chamferRight };
            BentleyStatus status = Modify.BooleanSubtract(ref capEntity, ref solidKernelEntities, solidKernelEntities.Length);
            #endregion

            //变换移动
            DPoint3d movePoint3d = new DPoint3d(
                lateralAngle > 90 ? Math.Abs(lateralOffset / 2) : -Math.Abs(lateralOffset / 2),
                -capLength / 2,
                -lateralOffset / 2 * baseSlope + topWallHeight) * GeneralBank.UorToMeters;
            DTransform3d trans = DTransform3d.Identity;
            trans.Translation = movePoint3d;
            TransformBody(ref capEntity, trans);
            Convert1.BodyToElement(out Element ehOutCap, capEntity, null, GeneralBank.ActiveDgnModel);
            ehOutCap.AddToModel();
            //属性赋予
            SetCoverCulvertECProperty setCoverCulvertECProperty = new SetCoverCulvertECProperty();
            setCoverCulvertECProperty.SetCapStoneECProperty(
                ehOutCap,
                capLength.ToString(),
                capHeight.ToString(),
                capWidth.ToString()
                );
            return ehOutCap;
        }
        /// <summary>
        /// 获取洞身构造参数
        /// </summary>
        /// <returns> 涵长,左偏角,右偏角,涵底坡度, 净跨,净高,挡块高度,基础襟边,台身厚度,基础厚度</returns>
        /// 
        private (double basicsLength, double leftLateralAngle, double rightLateralAngle, double baseSlope, double clearSpan, double clearHeight,
            double piecePly, double basicsEdge, double standPly, double basicsPly) GetUorCoverParameter()
        {
            double basicsLength = this.basicConstructor.BasicsLength / 100;
            double leftLateralAngle = this.basicConstructor.LeftLateralAngle;
            double rightLateralAngle = this.basicConstructor.RightLateralAngle;
            double baseSlope = this.basicConstructor.CulvertBaseSlope / 100;
            double clearSpan = this.basicConstructor.ClearSpan;
            double clearHeight = this.basicConstructor.ClearHeight;
            double piecePly = this.basicConstructor.PiecePly / 100;
            double basicsEdge = this.basicConstructor.BasicsEdge / 100;
            double standPly = this.basicConstructor.StandPly / 100;
            double basicsPly = this.basicConstructor.BasicsPly / 100;
            return (basicsLength, leftLateralAngle, rightLateralAngle, baseSlope, clearSpan, clearHeight, piecePly, basicsEdge, standPly, basicsPly);
        }

        /// <summary>
        /// 获取支撑梁构造参数
        /// </summary>
        /// <returns>涵长分段, 长度，高度，宽度，主筋边距</returns>
        private (List<double> culvertLenLists, double racingBeamLength, double bracingBeamHeight, double bracingBeamWidth, double bracingBeamInterva) GetBracingBeamParameter()
        {
            List<double> culvertLenLists = this.basicConstructor.CulvertLenLists;
            double racingBeamLength = this.basicConstructor.BracingBeamLength / 100;
            double bracingBeamHeight = this.basicConstructor.BracingBeamHeight / 100;
            double bracingBeamWidth = this.basicConstructor.BracingBeamWidth / 100;
            double bracingBeamInterva = this.basicConstructor.BracingBeamInterval / 100;
            return (culvertLenLists, racingBeamLength, bracingBeamHeight, bracingBeamWidth, bracingBeamInterva);
        }


        /// <summary>
        /// 基于dPoint3D点沿X轴绘制线
        /// </summary>
        /// <param name="boxCulvertLength">涵长水平距离</param>
        /// <param name="slop">坡度; (例如0.1就是10%的坡率)</param>
        /// <returns></returns>
        public LineElement GetSlopLinee(DPoint3d dPoint3D, double boxCulvertLength, double slop, out DPoint3d endPt)
        {
            double z = boxCulvertLength * slop;
            endPt = new DPoint3d(dPoint3D.X + boxCulvertLength, dPoint3D.Y, dPoint3D.Z + z) * GeneralBank.UorToMeters;
            return new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d(dPoint3D * GeneralBank.UorToMeters, new DPoint3d(dPoint3D.X + boxCulvertLength, dPoint3D.Y, dPoint3D.Z + z) * GeneralBank.UorToMeters));
        }

        public SolidKernelEntity CreateBodyFromSweep(CurveVector pathCur, CurveVector secCur, DgnModel modelRef)
        {
            pathCur.GetStartEnd(out DPoint3d startPt, out _, out DVector3d startTangent, out _);
            CurveVector secCur1 = secCur.Clone();
            BCIMNETGS.SolidUtil.Create.BodyFromSweep(out SolidKernelEntity entity, secCur1, pathCur, modelRef, false, true, false, null, null, null, null);
            return entity;
        }

        public override void CreateElementECProperty(Element element, List<Tuple<string, CustomProperty.TypeKind, bool, bool>> tuples)
        {
            throw new NotImplementedException();
        }
        public override List<(string standardName, string standValue)> CreateStandardECProperty()
        {
            throw new NotImplementedException();
        }

        public override double GetVolumeOfElement(Element element)
        {
            throw new NotImplementedException();
        }

        public override void SaveStandardECProperty(IDgnECInstance dgnECInstanc)
        {
            throw new NotImplementedException();
        }

        public override void SetECInstanceValue(IDgnECInstance dgnECInstance, List<(string propertyName, string calculationBasis, string computationalFormula)> propertyData)
        {
            throw new NotImplementedException();
        }
    }
}
